                //**************************************************************************************************************
// CLASS: Variable
//
// DESCRIPTION
// Declares a class that represents Variable operands in assembly language instructions. This class is derived
// from Operand. The Operand class stores the name of the Variable as a string, and this class adds an int32
// data member which is the 2's complement initial value of the Variable and an Address data member which is
// the address of the Variable within the data segment.
//
// AUTHOR INFORMATION
// Kevin R. Burger [KRB]
//   
// Mailing Address:
// Computer Science & Engineering
// School of Computing, Informatics, and Decision Systems Engineering
// Arizona State University
// Tempe, AZ 85287-8809
//
// Email: burgerk@asu
// Web:   http://kevin.floorsoup.com
//**************************************************************************************************************
#ifndef VARIABLE_HPP
#define VARIABLE_HPP

#include "Operand.hpp"

//==============================================================================================================
// CLASS: Variable
//==============================================================================================================
class Variable : public Operand {
public:
    //==========================================================================================================
    // PUBLIC FUNCTION MEMBERS:
    //==========================================================================================================

    //---------------------------------------------------------------------------------------------------------
    // Default ctor.
    //---------------------------------------------------------------------------------------------------------
    Variable(std::string const& pName = "", Address const pAddress = 0, Word const pInitValue = 0);

    //---------------------------------------------------------------------------------------------------------
    // Copy ctor.
    //---------------------------------------------------------------------------------------------------------
    Variable(Variable const& pVariable);

    //---------------------------------------------------------------------------------------------------------
    // Dtor.
    //---------------------------------------------------------------------------------------------------------
    ~Variable();

    //---------------------------------------------------------------------------------------------------------
    // GetAddress()
    //---------------------------------------------------------------------------------------------------------
    Address GetAddress() const;

    //---------------------------------------------------------------------------------------------------------
    // GetInitValue()
    //---------------------------------------------------------------------------------------------------------
    uint GetInitValue() const;

    //---------------------------------------------------------------------------------------------------------
    // GetName()
    //---------------------------------------------------------------------------------------------------------
    std::string GetName() const;

    //---------------------------------------------------------------------------------------------------------
    // operator=()
    //---------------------------------------------------------------------------------------------------------
    Variable& operator=(Variable const& pVariable);

    //---------------------------------------------------------------------------------------------------------
    // SetAddress()
    //---------------------------------------------------------------------------------------------------------
    void SetAddress(Address const pAddress);

    //---------------------------------------------------------------------------------------------------------
    // SetInitValue()
    //---------------------------------------------------------------------------------------------------------
    void SetInitValue(int32 const pInitValue);

    //---------------------------------------------------------------------------------------------------------
    // SetName()
    //---------------------------------------------------------------------------------------------------------
    void SetName(std::string const& pName);

protected:
    //==========================================================================================================
    // PROTECTED FUNCTION MEMBERS:
    //==========================================================================================================

    //---------------------------------------------------------------------------------------------------------
    // Copy()
    //---------------------------------------------------------------------------------------------------------
    void Copy(Variable const& pVariable);

private:
    //==========================================================================================================
    // PRIVATE DATA MEMBERS:
    //==========================================================================================================

    // mAddress is the address in the data segment of the Variable.
    Address mAddress;

    // mInitValue is the initial value of the Variable. This value is written to the binary file in
    // the data segment.
    uint mInitValue;

protected:
    void Copy(Variable const& pVariable);

};

#endif
